<?php

$htmlOutput = array();
$htmlOutput[] = '<div class="groups view">';
$htmlOutput[] = sprintf('<h2>%s</h2>', __('Group', true));
$htmlOutput[] = '	<dl>';
$i = 0; 
$class = ' class="altrow"';
$htmlOutput[] = sprintf('<dt %s>%s</dt>', ($i % 2 == 0)?$class:false, __('Id', true));
$htmlOutput[] = sprintf('<dd %s>', ($i++ % 2 == 0)?$class:false);
$htmlOutput[] =             $group['Group']['id'];
$htmlOutput[] = '			&nbsp;';
$htmlOutput[] = '		</dd>';
$htmlOutput[] = sprintf('<dt %s>%s</dt>', ($i % 2 == 0)?$class:false, __('Name', true));
$htmlOutput[] = sprintf('<dd %s>', ($i++ % 2 == 0)?$class:false);
$htmlOutput[] =             $group['Group']['name'];
$htmlOutput[] = '			&nbsp;';
$htmlOutput[] = '		</dd>';
$htmlOutput[] = sprintf('<dt %s>%s</dt>', ($i % 2 == 0)?$class:false, __('Created', true));
$htmlOutput[] = sprintf('<dd %s>', ($i++ % 2 == 0)?$class:false);
$htmlOutput[] =             $group['Group']['created'];
$htmlOutput[] = '			&nbsp;';
$htmlOutput[] = '		</dd>';
$htmlOutput[] = sprintf('<dt %s>%s</dt>', ($i % 2 == 0)?$class:false, __('Modified', true));
$htmlOutput[] = sprintf('<dd %s>', ($i++ % 2 == 0)?$class:false);
$htmlOutput[] =             $group['Group']['modified'];
$htmlOutput[] = '			&nbsp;';
$htmlOutput[] = '		</dd>';
$htmlOutput[] = '	</dl>';
$htmlOutput[] = '</div>';
$htmlOutput[] = '<div class="actions">';
$htmlOutput[] = '	<ul>';
$htmlOutput[] = sprintf('<li>%s</li>', $html->link(__('Edit Group', true), array('action'=>'edit', $group['Group']['id'])));
$htmlOutput[] = sprintf('<li>%s</li>', $html->link(__('Delete Group', true), array('action'=>'delete', $group['Group']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $group['Group']['id'])));
$htmlOutput[] = sprintf('<li>%s</li>', $html->link(__('List Groups', true), array('action'=>'index')));
$htmlOutput[] = sprintf('<li>%s</li>', $html->link(__('New Group', true), array('action'=>'add')));
$htmlOutput[] = sprintf('<li>%s</li>', $html->link(__('List Users', true), array('controller'=> 'users', 'action'=>'index')));
$htmlOutput[] = sprintf('<li>%s</li>', $html->link(__('New User', true), array('controller'=> 'users', 'action'=>'add')));
$htmlOutput[] = '	</ul>';
$htmlOutput[] = '</div>';
$htmlOutput[] = '<div class="related">';
$htmlOutput[] = sprintf('<h3>%s</h3>', __('Related Users', true));
if (!empty($group['User'])) {
$htmlOutput[] = '	<table cellpadding = "0" cellspacing = "0">';
$htmlOutput[] = '	<tr>';
$htmlOutput[] = sprintf('<th>%s</th>', __('Id', true));
$htmlOutput[] = sprintf('<th>%s</th>', __('Username', true));
$htmlOutput[] = sprintf('<th>%s</th>', __('Password', true));
$htmlOutput[] = sprintf('<th>%s</th>', __('Created', true));
$htmlOutput[] = sprintf('<th>%s</th>', __('Modified', true));
$htmlOutput[] = sprintf('<th>%s</th>', __('Group Id', true));
$htmlOutput[] = sprintf('<th class="actions">%s</th>', __('Actions', true));
$htmlOutput[] = '	</tr>';
$i = 0;
foreach ($group['User'] as $user) {
    $class = null;
    if ($i++ % 2 == 0) {
        $class = ' class="altrow"';
    }
    $htmlOutput[] = sprintf('<tr %s>', $class);
    $htmlOutput[] = sprintf('   <td>%s</td>', $user['id']);
    $htmlOutput[] = sprintf('   <td>%s</td>', $user['username']);
    $htmlOutput[] = sprintf('   <td>%s</td>', $user['password']);
    $htmlOutput[] = sprintf('   <td>%s</td>', $user['created']);
    $htmlOutput[] = sprintf('   <td>%s</td>', $user['modified']);
    $htmlOutput[] = sprintf('   <td>%s</td>', $user['group_id']);
    $htmlOutput[] = '           <td class="actions">';
    $htmlOutput[] =                 $html->link(__('View', true), array('controller'=> 'users', 'action'=>'view', $user['id']));
    $htmlOutput[] =                 $html->link(__('Edit', true), array('controller'=> 'users', 'action'=>'edit', $user['id']));
    $htmlOutput[] =                 $html->link(__('Delete', true), array('controller'=> 'users', 'action'=>'delete', $user['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $user['id']));
    $htmlOutput[] = '			</td>';
    $htmlOutput[] = '		</tr>';
}
$htmlOutput[] = '	</table>';
}
$htmlOutput[] = '	<div class="actions">';
$htmlOutput[] = '		<ul>';
$htmlOutput[] = sprintf('<li>%s</li>', $html->link(__('New User', true), array('controller'=> 'users', 'action'=>'add')));
$htmlOutput[] = '		</ul>';
$htmlOutput[] = '	</div>';
$htmlOutput[] = '</div>';

echo implode("\n", $htmlOutput);

?>